#include<iostream>
using namespace std;
const int N = 150;
int a[N][N], f[N][N];
int n;
int ret;
int main()
{
	cin >> n;
	for (int i = 1;i <= n;i++)
	{
		for (int j = 1;j <= n;j++)
		{
			int x=0;//注意这个地方不用a[i][j]
			cin >> x;
			f[i][j] = f[i - 1][j] + f[i][j - 1] - f[i - 1][j - 1] + x;
		}
	}

	//寻找最大的区块
	//没想到用四层循环没有超时，还真让我给过了
	for (int i = 0;i <= n;i++)//注意要从0开始
	{
		for (int j = 0;j <= n;j++)
		{
			for (int x = i;x <= n;x++)
			{
				for (int y = j;y <= n;y++)
				{
					int p = f[x][y] - f[x][j] - f[i][y] + f[i][j];
					ret = max(ret, p);
				}
			}
		}
	}
	cout << ret << endl;
	return 0;

}
